package com.ss.android.article.base.feature.detail2.video.a;

import android.text.TextUtils;

import com.ss.android.article.base.feature.app.d.CommonImpressionAdapter;
import com.ss.android.article.base.feature.model.Article;
import com.ss.android.article.base.feature.model.RelatedVideoTouTiao;
import com.ss.android.article.base.feature.model.RelatedWenda;

import java.util.List;

final class o extends CommonImpressionAdapter {
    private final l c;
    private final int a;
    private final boolean b;

    o(l arg3, String arg4) {
        super(arg4, 8, (byte) 0);
        this.c = arg3;
        this.a = 8;
        this.b = true;
    }

    public final String a(int arg11) {
        String v0_2;
        String v2;
        Object v0_1;
        List v0 = null;
        List v4 = null;
        List v3 = null;
        String v1 = null;
        if (this.c.H != null) {
            switch (this.a) {
                case 8:
                    v4 = this.c.H.relatedVideoToutiaoList;
                    break;
                case 9:
                    v0 = this.c.H.relatedNewsList;
                    break;
                case 10:
                    v0 = this.c.H.relatedGalleryList;
                    break;
                case 11:
                    v4 = this.c.H.relatedVideoToutiaoList;
                    break;
                case 17:
                    v3 = this.c.H.j;
                    break;
            }
        }


        if (arg11 < 0 || v0 == null || arg11 >= v0.size()) {
            v2 = super.a(arg11);
        } else {
            v0_1 = v0.get(arg11);
            if (v0_1 == null) {
                v2 = super.a(arg11);
            } else if (((Article) v0_1).groupId <= 1) {
                v0_2 = !TextUtils.isEmpty(((Article) v0_1).openPageUrl) ? ((Article) v0_1).openPageUrl : ((Article) v0_1).openUrl;
                if (TextUtils.isEmpty(((CharSequence) v0_2))) {
                    v0_2 = super.a(arg11);
                }

                v2 = v0_2;
            } else {
                long v6 = ((Article) v0_1).groupId;
                long v8 = ((Article) v0_1).itemId;
                v0_2 = this.b ? ((Article) v0_1).videoId : v1;
                v2 = android.support.design.a.a(v6, v8, v0_2);
            }
        }

        if (this.a == 17 && v3 != null && arg11 < v3.size()) {
            v0_1 = v3.get(arg11);
            if (v0_1 != null) {
                v2 = ((RelatedWenda) v0_1).questionId + "_" + ((RelatedWenda) v0_1).answerId;
            }
        }

        if ((this.a == 8 || this.a == 11) && (v4 != null && arg11 < v4.size())) {
            Article v0_3 = ((RelatedVideoTouTiao)v4.get(arg11)).article;
            if (v0_3 != null) {
                long v2_1 = v0_3.groupId;
                long v4_1 = v0_3.itemId;
                if (this.b) {
                    v1 = v0_3.videoId;
                }

                v2 = android.support.design.a.a(v2_1, v4_1, v1);
            }
        }

        return v2;
    }
}

